local determination = fk.CreateSkill {
  name = "determination",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["determination"] = "决心",
  [":determination"] = "锁定技，你的回合内，每有X张牌进入弃牌堆，你下次造成的伤害+1（X为你的体力上限）。",

  ["@determination"] = "决心",
  ["@determination1"] = "伤害+",
  ["$determination"] = "承载地底の希望",
}

determination:addLoseEffect(function (self, player, is_death)
  player.room:setPlayerMark(player, "@" .. determination.name, 0)
end)



local determination_refresh_spec = {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(determination.name) and player.room.current == player
  end,
  on_refresh = function(self, event, target, player, data)
    for _, move in ipairs(data) do
      if move.toArea == Card.DiscardPile then
        for _, info in ipairs(move.moveInfo) do
        player.room:addPlayerMark(player, "@" .. determination.name, 1)
      end
    end
  end


  while player:getMark("@determination") >= player.maxHp do
    player.room:removePlayerMark(player, "@determination", player.maxHp)
    if player.dead then return false end
    player.room:addPlayerMark(player, "@determination1", 1)
    if player.dead then return false end
  end
end,
}


determination:addEffect(fk.AfterCardsMove, determination_refresh_spec)

determination:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("@determination1") > 0
  end,
  on_use = function(self, event, target, player, data)
    data:changeDamage(player:getMark("@determination1"))
    player.room:setPlayerMark(player, "@determination1", 0)
  end,
})

return determination
